<template>
    <div id="good_display" v-if="Object.keys(message).length !==0">
        <p class="detail">{{message.desc}}</p>
        <p class="title">{{message.detailImage[0].key}}</p>
        <div>
            <img :src="item" class="goods_img" v-for="(item,index) in message.detailImage[0].list"
                 :key="index" @load="imgLoad">
        </div>
    </div>
</template>

<script>
    export default {
        name: "GoodDisplay",
        props:{
            message:{}
        },
        data(){
            return{
                count:0,
                imgLength:Number
            }
        },
        methods:{
            imgLoad(){
                if (++this.count !== this.imgLength){
                    this.$emit('imgLoad')
                }
            }
        },
        watch:{
           detailInfo(){
                this.imgLength = this.message.detailImage[0].list.length
            }
        }
    }
</script>

<style scoped>
    #good_display{
        margin-top: 20px;
    }
.goods_img{
    width: 100%;
}
    .detail{
        font-size: 10px;
        font-style: italic;
        margin-left: 10px;
    }
    .title{
        margin-top: 10px;
        font-style: oblique;
        color: lightcoral;
        text-align: center;
        padding-bottom: 10px;
    }
</style>